﻿using UnityEngine;
using System.Collections;

public class EventDetector : MonoBehaviour {

	private RayBoxController padController;

	void Start() {

		padController = transform.parent.GetComponent<RayBoxController> ();
		if (padController == null) {

			Debug.LogError ("因为HTC Controller的关系，请保证EventDetector所在物体的父物体上挂着RayBoxController组件。");

		}

	}

	void OnTriggerEnter(Collider other) {

		padController.EnableDrag (true);

	}

	void OnTriggerExit(Collider other) {

		padController.EnableDrag (false);

	}
}
